#ifndef ANIMATOR_H
#define ANIMATOR_H

#include "OGRE/OgreAnimationState.h"
#include "OGRE/OgreEntity.h"
#include <map>

struct AnimationData
{
	float startWeight;
	float speed;
};

enum AnimationType
{
	ANIM_UPPER,
	ANIM_LOWER,
	ANIM_FULL
};

typedef std::map<Ogre::AnimationState*, AnimationData> AnimationMap;

class Animator
{
public:
	Animator(Ogre::Entity *ent);
	virtual ~Animator(void);
	void playAnimation(const AnimationType type, const Ogre::String &name, const bool loop = false, const bool overwrite = false, const float speed = 1.f, const float pos= 0.f, const float FadeDuration = 0.3f);
	void stepAnimation(const unsigned long elapsedTime);
	Ogre::String getCurrentAnimationName(const AnimationType type) const;
	Ogre::AnimationState* getAnimation(const Ogre::String &name);
	void resetAnimations(void);
private:
	Ogre::AnimationStateSet* mSet;
	AnimationMap mDataMap;
	Ogre::AnimationState *mpCurrentFullAnimation;
	Ogre::AnimationState *mpCurrentUpperAnimation;
	Ogre::AnimationState *mpCurrentLowerAnimation;
	float fadeTime;
	float fadeDuration;
};

#endif